package base;

import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AutoCompleteTextView;

import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;

import shanshuitiancheng.news.MainActivity;

/**
 * Created by cch on 2016/6/13.
 */
public abstract class BaseFragment extends Fragment {
    public View view;
    public Context ct;
    public SlidingMenu sm;
    public boolean flag = false;
    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        initData(savedInstanceState);
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ct = getActivity();
         sm =((MainActivity)getActivity()).getSlidingMenu();
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
         view = initView(inflater);
        return view;
    }

    public View getRootView(){
        return view;
    }

//    初始化view
    public abstract View initView(LayoutInflater inflater);

//    初始化数据
    public abstract void initData(Bundle savedInstanceState);
}
